#include "MenuScene.h"

cocos2d::Scene *MenuScene::createScene()
{
    return MenuScene::create();
}

bool MenuScene::init()
{
    if (!Scene::init()) 
	{
        return false;
    }
    
    // ...这里写一些当前场景的布局
    MenuItemFont *item1 = MenuItemFont::create("item1", CC_CALLBACK_1(MenuScene::menuItemClicked, this));
    item1->setTag(1);
    
    MenuItemFont *item2 = MenuItemFont::create("item2", CC_CALLBACK_1(MenuScene::menuItemClicked, this));
    item2->setTag(2);
    
    MenuItemFont *item3 = MenuItemFont::create("item3", CC_CALLBACK_1(MenuScene::menuItemClicked, this));
    item3->setTag(3);
    
    Menu *menu = Menu::create(item1, item2, item3, NULL);
    menu->alignItemsVerticallyWithPadding(400);
    addChild(menu);
    
    return true;
}

void MenuScene::menuItemClicked(Ref *sender)
{
    MenuItem *item = (MenuItem *)sender;
    log("菜单被点击～～～～ %d", item->getTag());
}
